// components/select-gender/index.js
Component({

    /*
    * 接收外部样式
    * */
    options: {
        addGlobalClass: true
    },

    /**
     * 组件的属性列表
     */
    properties: {
        gender: {
            type: String,
            value: "男"
        },
        color: {
            type: String,
            value: "var(--color-enterprise-primary)"
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        /*
       * 监听开关状态切换
       * */
        onSwitchChange() {
            let gender = this.data.gender;
            this.setData({
                gender: gender === "男" ? "女" : "男"
            })
            this.triggerEvent("genderChange", {value: gender === "男" ? "女" : "男"}, {});
        },
    }
})
